<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>业主预存费用</title>
<LINK href="images/css.css" type="text/css" rel="stylesheet">
<script language="javascript">
	var req;
	
	function init() {
		if (window.XMLHttpRequest) {
			req = new XMLHttpRequest();
		} else if (window.ActiveXObject) {
			req = new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	
	//根据房产编号查询DropChangeAJAXAction，判断该房产是否存在
	function findHouseByHouseId() {
		init();
		var url="dropChangeAJAX.do?method=findHouseByHouseId&houseId="+escape(document.forms[0].houseId.value);
		
		req.open("get", url, true);
		req.onreadystatechange = callback;
		req.send(null);
	}

	function callback() {
		if (4 == req.readyState) {
			if (200 == req.status) {
				//如果响应成功，读取响应数据
				var info = req.responseText;
				document.getElementById("errorSpan").innerHTML=info;
				document.getElementById("noticeSpan").style.display="none";
			}
		}
	}

	function checkForm() {
		var houseId = document.forms[0].houseId.value;
		var amounts = document.forms[0].amount;
		
		if (houseId == null || houseId == "") {
			alert("请输入房产编号！");
			return false;
		} else if (houseId.length!=11) {
			alert("请输入11位房产编号！");
			return false;
		}
		var count = 0;
		for(var i=0;i<amounts.length;i++) {
			if (amounts[i].value != 0) {
				count++;
			}
		}
		if(count==0) {
			alert("请输入欠费金额");
			return false;
		}			
		return true;
	}

	function checkForm() {
		var balance = document.forms[0].balance.value;

		if (balance==0) {
			alert("请输入预存金额！");
			return false;
		}
		return true;
	}
</script>
</head>
<body>
<html:form action="account.do?method=save" method="post" onsubmit="return checkForm();">
  <html:hidden property="ownerId" value="${owner.id }"/>
  <html:hidden property="criteria" value="${money1 }" />
  <table align="center" width="80%" border="0">
    <tr>
      <td class="STYLE4" align="center" bgcolor="#ffffff" colspan="2" height="40">业主账户预存费用</td>
    </tr>
    <tr>
    <td>
    <table class="tableline" cellspacing="1" cellpadding="0" width="100%" border="0">
    <tr>
      <td width="30%" height="26" align="right" bgcolor="#ffffff">业主姓名：</td>
      <td width="70%" bgcolor="#ffffff">
        &nbsp;${owner.name }
        <font color="red"></font>&nbsp;&nbsp;
      </td>
    </tr>
    <tr>
      <td width="30%" height="26" align="right" bgcolor="#ffffff">业主手机：</td>
      <td width="70%" bgcolor="#ffffff">
        &nbsp;${owner.phone }
        <font color="red"></font>&nbsp;&nbsp;
      </td>
    </tr>
    <tr>
      <td width="30%" height="26" align="right" bgcolor="#ffffff">业主身份证：</td>
      <td width="70%" bgcolor="#ffffff">
        &nbsp;${owner.idCard }
        <font color="red"></font>&nbsp;
      </td>
    </tr>
    <tr>
      <td width="30%" height="26" align="right" bgcolor="#ffffff">房产信息：</td>
      <td width="70%" bgcolor="#ffffff"> 
      	<c:if test="${!empty houseSet}">
		 <c:forEach items="${houseSet}" var="house">
		 &nbsp;房产编号：${house.houseId } 房产类型：${house.type.name }
		 </c:forEach>
		</c:if>
        <font color="red"></font>&nbsp;
      </td>
    </tr>
    <tr>
      <td width="30%" height="26" align="right" bgcolor="#ffffff">账户余额(元)：</td>
      <td width="70%" bgcolor="#ffffff">
        &nbsp;<font color="red"><fmt:formatNumber value="${balance }" pattern="0.00" /></font>&nbsp;
      </td>
    </tr>
    <tr>
      <td width="30%" height="26" align="right" bgcolor="#ffffff">预收物业服务费(元)：</td>
      <td width="70%" bgcolor="#ffffff">
        &nbsp;<html:text property="amount" value="0"/>&nbsp;&nbsp;<span id="showInfo1" style="color:#5f9c12;">收费标准：<fmt:formatNumber value="${money1 * 6 }" pattern="0.00" />/半年，<fmt:formatNumber value="${money1 * 12 }" pattern="0.00" />/年</span>
      </td>
    </tr>
    <tr>
      <td width="30%" height="26" align="right" bgcolor="#ffffff">装修保证金(元)：</td>
      <td width="70%" bgcolor="#ffffff">
        &nbsp;<html:text property="amount" value="0"/>&nbsp;&nbsp;<span id="showInfo2" style="color:#5f9c12;">收费标准：<fmt:formatNumber value="${money2 }" pattern="0.00" />/一次性，装修完毕后退还</span>
      </td>
    </tr>
    <tr>
      <td width="30%" height="26" align="right" bgcolor="#ffffff">装修服务费(元)：</td>
      <td width="70%" bgcolor="#ffffff">
        &nbsp;<html:text property="amount" value="0"/>&nbsp;&nbsp;<span id="showInfo3" style="color:#5f9c12;">收费标准：<fmt:formatNumber value="${money3 }" pattern="0.00" />/一次性</span>
      </td>
    </tr>  
    <tr>
      <td width="30%" height="26" align="right" bgcolor="#ffffff">装修垃圾清运费(元)：</td>
      <td width="70%" bgcolor="#ffffff">
        &nbsp;<html:text property="amount" value="0"/>&nbsp;&nbsp;<span id="showInfo4" style="color:#5f9c12;">收费标准：<fmt:formatNumber value="${money4 }" pattern="0.00" />/一次性</span>
      </td>
    </tr> 
    <tr>
      <td width="30%" height="26" align="right" bgcolor="#ffffff">预存账户资金(元)：</td>
      <td width="70%" bgcolor="#ffffff">
        &nbsp;<html:text property="amount" value="0"/>&nbsp;&nbsp;<span id="showInfo5" style="color:#5f9c12;">将现金存入账户后，可使用账户资金支付物业费用</span>
      </td>
    </tr>     
    <tr>
      <td colspan="2" align="center" bgcolor="#ffffff">
      	<html:submit value="预存费用到业主账户" />&nbsp;&nbsp;<span style="color:red">${depositLeastZeroError }${depositAllZeroError }${type2ExistsError }${type3ExistsError }${type4ExistsError }</span>
      </td>
    </tr>        
    </table></td></tr>   
  </table>
  </html:form>
</body>
</html>